Skip to content

Accept sentinel values as instances of the runtime sentinel class - #5697

Open
synnks wants to merge 1 commit into
pyrefly-org:mainfrom
synnks:fix/sentinel-runtime-class
Open

synnks wants to merge 1 commit into
pyrefly-org:mainfrom
synnks:fix/sentinel-runtime-class

Conversation

@synnks

@synnks synnks commented Nov 19, 2026

Copy link
Copy Markdown

Summary

Sentinel values such as MISSING = Sentinel("MISSING") were not assignable to Sentinel.
A sentinel value is now treated as an instance of the runtime sentinel class, the same way None falls back to NoneType. The rule is one-way, so different sentinels remain incompatible.

Fixes #5696

  • I am a human, and I fully understand the code I am submitting.

Test Plan

Added two tests to test/sentinel.rs, one for typing_extensions.Sentinel and one for the built-in sentinel on Python 3.15. Both failed before the change.
Full cargo test suite, format, lint and conformance pass.

@meta-codesync

meta-codesync Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

This pull request has been imported. If you are a Meta employee, you can view this in D133176463. (Because this pull request was imported automatically, there will not be any future comments.)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sentinel values are not assignable to Sentinel

1 participant